home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / net / bind-contrib.tar.gz / bind-contrib.tar / contrib / misc / makezones.info < prev    next >
Encoding:
Internet Message Format  |  1996-10-25  |  11.3 KB

  1. Received: by gw.home.vix.com id AA27986; Thu, 21 Apr 94 09:04:27 -0700
  2. Received: by gw.home.vix.com id AA27961; Thu, 21 Apr 94 09:02:59 -0700
  3. Received: from grus.cus.cam.ac.uk [131.111.8.3] (TAP id = root) 
  4.     by bootes.cus.cam.ac.uk with smtp 
  5.     (Smail-3.1.28.1 #136) id m0pu1DC-000BzbC; Thu, 21 Apr 94 17:02 BST
  6. Received: by grus.cus.cam.ac.uk 
  7.     (Smail-3.1.28.1 #136) id m0pu1DB-0007aLC; Thu, 21 Apr 94 17:02 BST
  8. Message-Id: <m0pu1DB-0007aLC@grus.cus.cam.ac.uk>
  9. To: bind-workers@vix.com
  10. Cc: ph10@cus.cam.ac.uk
  11. Subject: makezones
  12. Date: Thu, 21 Apr 94 17:02:44 +0100
  13. From: Tony Stoneley <ajms@cus.cam.ac.uk>
  14.  
  15. Another offering for the DNS database tools deliberations -
  16.  
  17. We maintain our dns zone (cam.ac.uk.) by hand editing a file that is
  18. essentially a forward zone file (with escapes), but which is then
  19. processed by a perl script "makezones" (a) to check it for idiocies and
  20. (b) to generate the actual forward and reverse zone files.  Documentation
  21. is in comments in the script, but I append an extract.  makezones is
  22. available for anon ftp in
  23.  
  24.   ftp.cus.cam.ac.uk:/pub/software/programs/DNS/makezones
  25.  
  26. Further enquiries or comments to the author,
  27.     Philip Hazel <ph10@cus.cam.ac.uk>
  28. please, not to me; I'm merely a grateful user. 
  29.  
  30. --
  31. Tony Stoneley            Email:  Tony.Stoneley@ucs.cam.ac.uk
  32. Computing Service        Phone:  +44 223 334710
  33. Cambridge University
  34. ----------------------------------------------------------------
  35.  
  36. # Makezones handles the updating of the serial number automatically. It
  37. # does this by updating the SOURCE FILE before generating the zone files.
  38. #                >>>>>      NB NB NB NB      <<<<<
  39. # The source file therefore has to be writeable. Makezones insists that
  40. # the format of the serial number be <year><month><day><version> and that
  41. # the year be four digits long, so that this code will continue to work 
  42. # after then end of 1999.
  43. #
  44. # Makezones handles Class B and Class C networks, because those are the
  45. # ones that are around here in Cambridge, UK. It would not be hard to 
  46. # extend it to handle a Class A if that were required.
  47. #
  48. # Because the file should normally be correct, makezones makes no attempt
  49. # attempt to continue if it finds a serious error. It just reports it and 
  50. # stops. However, syntax errors in the general records don't prevent it
  51. # going on to check further records, so you can get more than one error
  52. # message in a run. However, if it finds too many errors it says so, and
  53. # gives up. "Too many" is currently more than ten.
  54. #
  55. # The input file looks like a normal DNS zone file, with the addition of
  56. # the following rules, which impose additional restrictions. Some of these
  57. # rules are to make it easy for makezones; some of them impose conventions
  58. # that we use in Cambridge which might not be liked elsewhere. The code is
  59. # well commented, and should be easy to modify.
  60. #
  61. #   . The class field ("IN") and the type fields ("A", "CNAME", etc.) must
  62. #     be specified in upper case, as must "TCP" and "UDP" in WKS records.
  63. #
  64. #   . With the exception of the SOA & WKS records, all records must be 
  65. #     complete on one line of input. That is, continuation is not supported
  66. #     in general.
  67. #
  68. #   . The SOA record must be right at the start of the file, and must be
  69. #     set up so that each numeric parameter is on a separate line. For
  70. #     example:
  71. #
  72. #     @    IN    SOA    cus.cam.ac.uk. hostmaster.ucs.cam.ac.uk. (
  73. #                             1993080601      ; Serial
  74. #                             10800           ; Refresh 3 hours
  75. #                             3600            ; Retry 1 hour
  76. #                             604800          ; Expire after a week
  77. #                             86400 )         ; Minimum ttl
  78. #
  79. #     Note that the serial number begins with the full year number, not just
  80. #     the last two digits. The SOA record is expected to have the "IN" class
  81. #     field; subsequent records may omit it.
  82. #
  83. #   . The NS records for the zone must appear at the top of the file, just
  84. #     after the SOA record. These will be copied into the forward and the
  85. #     reverse zone files. That is, the default assumption is that the name-
  86. #     servers are the same for the forward and reverse zones. These NS records
  87. #     must NOT have anything in the name field. The copying stops on reaching
  88. #     the first record with a name field or the first non-NS record.
  89. #
  90. #   . Makezones can also cope with the case where there are different NS
  91. #     records for the different zones. If an NS record at the top of the
  92. #     file contains text after the nameserver name, this is taken as a list
  93. #     of zones to which this NS record applies. For example,
  94. #
  95. #            IN    NS    abcd.some.domain.   some.domain.  144.44.0.0
  96. #    
  97. #     The reverse zones are identified by their IP network numbers. If there
  98. #     are a lot of them, multiple instances of this special kind of qualified
  99. #     NS record can be used.
  100. #
  101. #   . NS records must always refer to fully qualified names. Makezones checks
  102. #     for the final dot, because it is so easy to overlook this.
  103. #   
  104. #   . Comment lines are not normally copied into the working zone files. They
  105. #     can, however, be forced into them by the following syntax:
  106. #     
  107. #     ;F   copy this comment (without the F) into the forward file
  108. #     ;R   copy this comment (without the R) into the reverse file
  109. #   . All records except PTR records are normally copied to the forward file. 
  110. #     However, A records can be marked as "reverse only" by preceding them
  111. #     with ">R " at the start. In this case, no A record is written to the
  112. #     forward file, but a PTR record is constructed for the appropriate
  113. #     reverse zone file. There should be exactly one space after the ">R";
  114. #     three characters are removed from the start of the record. If ">R" is
  115. #     followed by a tab, the tab is not removed (i.e. it acts as more than
  116. #     one space).
  117. #     
  118. #   . PTR records and A records are the only ones used when generating the 
  119. #     reverse zone files. "A" records can be marked "forwards only" by preced- 
  120. #     ing them with ">F " at the start. This suppresses generation of a PTR 
  121. #     record for the reverse zone. It does not, however, suppress the check that
  122. #     the address is in one of the networks being handled (see next item for
  123. #     external networks). If more than one A record has the same IP address,
  124. #     then all but one must have the ">F " flag, to ensure that only one PTR
  125. #     record is generated (for the canonical name). Again, there must be
  126. #     exactly one space or a tab after ">F".
  127. #     
  128. #   . We want to be able to check that all IP addresses are in one of the 
  129. #     networks that we are processing for. However, occasionally a record must
  130. #     specify an external network (glue records are the prime example). Such 
  131. #     records must be flagged by ">E " at their start to override the error 
  132. #     that would otherwise occur. (They naturally won't get into any reverse 
  133. #     zones.) The special local address 127.0.0.1 is recognized and treated as
  134. #     though ">E " is always present. The ">E " flag can be used on WKS 
  135. #     records as well as on A records.
  136. #
  137. #   . The name given for PTR records must be a complete, reversed IP address
  138. #     that corresponds to one of the reverse zones. The network portion of
  139. #     the "name" is removed when generating the PTR record for the reverse
  140. #     zone. PTR records have to be used instead of A records flagged with
  141. #     ">R " ("reverse only") when the name concerned is not in the domain
  142. #     of the forward zone, because of the following rule.
  143. #
  144. #   . The names on all records must not end with . as we conventionally
  145. #     specify them as partial domains for the forward zone. This means that,
  146. #     if you want a record with the name of the zone as its domain, you must
  147. #     use the "@" notation, which is supported.
  148. #
  149. #   . Makezones assumes that names consist of letters and digits, and start
  150. #     with a letter. You can, however, override this by enclosing a name
  151. #     in quotes. For example:
  152. #
  153. #     "3cpu"   A     134.232.45.69
  154. #
  155. #     I didn't want to allow these through normally, as in my zone they are
  156. #     more likely to be typos. You can change the rules for what characters
  157. #     are allowed in names (without quoting) by editing the variable 
  158. #     $name_pattern (see under CONFIGURATION VARIABLES at the head of this 
  159. #     file).
  160. #
  161. #   . CNAME records must point to fully qualified names. Makezones checks
  162. #     that if a name appears on a CNAME, it does not appear on any other
  163. #     record.
  164. #
  165. #   . MX records must point to fully qualified names.
  166. #     
  167. #
  168. # Makezones is run by a command of the following form:
  169. #
  170. #   makezones [options] <source> <forward-zone> <forward-zone-file> \
  171. #     [<reverse-zone-file>]*
  172. #
  173. # For example:
  174. #   makezones  DBsource  cam.ac.uk  db.cam  db.131.111  db.192.153.213
  175. #   
  176. # The source file is specified as the first argument. The second and third
  177. # arguments specify the name of the zone and the file into which the records
  178. # for that zone are to be written. The name is required so that fully
  179. # qualified names can be generated in the reverse zone files. The remaining
  180. # arguments specify the networks for which reverse zone files are to be 
  181. # written, and the corresponding files. There need not be any if there are 
  182. # no PTR or non-forwards-only A records in the source file. Each of these 
  183. # final arguments is the name of a zone file. The first part of the name can 
  184. # be anything you like - the only requirement is that the name must end with 
  185. # a valid Class B or Class C network number.
  186. #
  187. # [This combining of network number and zone file name is done for convenience.
  188. # To change makezones so that the numbers and file names are given as separate
  189. # arguments would not be difficult; the changes would affect only the sub-
  190. # routine that unpicks the arguments.]
  191. #
  192. # It is intended that makezones will normally be run as part of a "make" 
  193. # sequence which will also install the files and reload the nameserver(s)
  194. # after makezones has run successfully. Thus, the command to run it will
  195. # normally be stored in a file and not typed each time.
  196. # The output files are actually written to temporary files whose names are the 
  197. # same as the final ones with ".new" appended. If the processing succeeds,
  198. # these files are renamed; if it fails, they are deleted.
  199. #
  200. # Normally no options are required. There is currently only one option:
  201. #
  202. #   -short   Used when a new zone file is more than 5% shorter than the 
  203. #            previous version. If not given, the processing will fail if
  204. #            a new file is that much shorter. This guards against the case
  205. #            of accidental loss of large portions of the source file. Setting
  206. #            -short disables the length checking for all zones. You need to
  207. #            set this option if the previous versions of the files do not
  208. #            exist. The script can be configured to default to -short; see
  209. #            "configuration options" above.
  210. # The input file must be writable. The first thing the script does is to update
  211. # the serial number in the original file. This forms a permanent record and 
  212. # ensures that all the created zones have the same number. The form of the
  213. # serial number must be <year><month><day><sequence>, as in the example SOA
  214. # record shown above. The code will continue to work after December 31, 1999.
  215. # If more than 99 updates are done in one day, the failure is soft in that a 
  216. # valid serial number is still generated, though it no longer contains that
  217. # day's date.
  218.